package ru.compft.common.data;

import ru.compft.common.data.meta.SettingTableMeta;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: VVasiliev
 * Date: 24.09.12
 * Time: 13:46
 * Класс представляющий объект "Настройка системы"
 */
@Entity
@Table(name = SettingTableMeta.TABLE_NAME)
public class Setting implements Serializable {
    private static final long serialVersionUID = 6653888959119734042L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = SettingTableMeta.ID, unique = true, nullable = false)
    private Long id;

    @Column(name = SettingTableMeta.CODE, unique = true, nullable = false)
    private String code; // Код настройки

    @Column(name = SettingTableMeta.VALUE)
    private String value; // Значение настройки

    @Column(name = SettingTableMeta.DESCRIPTION)
    private String description; // Описание настройки

    public Setting() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Setting");
        sb.append("{id=").append(id);
        sb.append(", code='").append(code).append('\'');
        sb.append(", value='").append(value).append('\'');
        sb.append(", description='").append(description).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
